<!--
* @Author: white_queen
* @Date: 2024-07-19 18:05:13
* @LastEditors: white_queen
* @LastEditTime: 2024-07-19 18:05:16
* @FilePath: /pages/scoreShop/order/order.vue
* @Description: 我的兑换
* 
{"state":"0:全部1:待付款 2：待发货 3：待收货 4：已完成","page":"页码","limit":"页数"}
-->

<template>
	<view>
		<u-sticky bgColor="#fff">
			<u-tabs
				@click="click"
				:list="list4"
				lineWidth="30"
				lineColor="#541A5F"
				:current="avtiveCurrent"
				:activeStyle="{
					color: '#541A5F',
					fontWeight: 'bold',
					transform: 'scale(1.05)'
				}"
				:inactiveStyle="{
					color: '#000000',
					transform: 'scale(1)'
				}"
				itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
			></u-tabs>
		</u-sticky>
		<view class="list">
			<u-list @scrolltolower="scrolltolower">
				<u-list-item v-for="i in 5" :key="i">
					<view class="item" @click="chlickItem(item)">
						<view class="top">
							<view class="left">
								<text>订单编号:18051081888625</text>
							</view>
							<view class="right">
								<text>待付款</text>
							</view>
						</view>
						<view class="content">
							<image class="product" src="../../../static/logo.png" mode="aspectFill"></image>
							<view class="right">
								<view class="right-top">
									<text class="name">定力之门 (土)</text>
									<text class="sku">规格：土系</text>
								</view>
								<view class="right-bottom">
									<text class="money">¥999.00</text>
									<text class="num">x1</text>
								</view>
							</view>
						</view>
						<view class="item-bottom">
							<text class="all-num">共1件</text>
							<text class="all-money">合计：¥999.00</text>
						</view>
						<view class="item-btns">
							<view @click="cancel(item)" class="item-btn">取消</view>
							<view @click="del(item)" class="item-btn">删除订单</view>
							<view @click="payment(item)" class="item-btn bg">付款</view>
							<view @click="look(item)" class="item-btn">查看物流</view>
							<view @click="confirm(item)" class="item-btn bg">确认收货</view>
						</view>
					</view>
				</u-list-item>
			</u-list>
		</view>
	</view>
</template>

<script>
import httpApi from '../../../http';
export default {
	onLoad(e) {
		console.log(e.type);
		this.avtiveCurrent = e.type;
		this.init();
	},
	data() {
		return {
			avtiveCurrent: 0,
			colors: ['#A7A7A7', '#CFAE7D', '#000000'],
			list4: [
				{
					name: '全部'
				},
				{
					name: '待付款'
				},
				{
					name: '待发货'
				},
				{
					name: '待收货'
				},
				{
					name: '已完成'
				}
			]
		};
	},
	methods: {
		// 初始化
		init() {
			httpApi.ScoreShopApi.getOrderList({ state: this.avtiveCurrent, limit: 10, page: 1 }).then((res) => {
				console.log(res);
			});
		},
		// 触底
		scrolltolower() {
			uni.showToast({
				title: '触底了'
			});
		},
		// 点击标签触发,回调参数 => item
		click(item) {},
		// 取消订单
		cancel(item) {},
		// 删除订单
		del(item) {},
		// 付款
		payment(item) {},
		// 查看物流
		look(item) {},
		// 确认收货
		confirm(item) {},
		// 查看详情
		chlickItem(item) {
			uni.navigateTo({
				url: '/pages/scoreShop/orderDetail/orderDetail?id=1' /* + item.id */
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.list {
	height: calc(100vh - 68rpx);
	width: 750rpx;
	background-color: #fff;
	.item {
		width: 654rpx;
		background: #f7f7f8;
		border-radius: 20rpx;
		margin: 24rpx 48rpx;
		padding: 18rpx 30rpx 30rpx;
		box-sizing: border-box;
		.top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;
			.left {
				font-family: SourceHanSerifCN, SourceHanSerifCN;
				font-weight: 400;
				font-size: 24rpx;
				color: #383838;
				line-height: 34rpx;
			}
			.right {
				font-family: SourceHanSerifCN, SourceHanSerifCN;
				font-weight: 400;
				font-size: 28rpx;
				color: #a7a7a7;
				line-height: 40rpx;
			}
		}
		.content {
			display: flex;
			align-items: center;
			padding: 26rpx 0 30rpx;
			border-top: 2rpx solid #ebebeb;
			border-bottom: 2rpx solid #ebebeb;
			.product {
				width: 160rpx;
				height: 160rpx;
				margin-right: 30rpx;
				border-radius: 10rpx;
			}
			.right {
				height: 160rpx;
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				.right-top {
					display: flex;
					flex-direction: column;
					.name {
						font-family: SourceHanSerifCN, SourceHanSerifCN;
						font-weight: 500;
						font-size: 32rpx;
						color: #303133;
						line-height: 46rpx;
					}
					.sku {
						font-family: SourceHanSerifCN, SourceHanSerifCN;
						font-weight: 400;
						font-size: 24rpx;
						color: #909399;
						line-height: 34rpx;
						margin-top: 10rpx;
					}
				}
				.right-bottom {
					display: flex;
					justify-content: space-between;
					.money {
						font-family: SourceHanSerifCN, SourceHanSerifCN;
						font-weight: 500;
						font-size: 24rpx;
						color: #333333;
						line-height: 34rpx;
					}
					.num {
						font-family: SourceHanSerifCN, SourceHanSerifCN;
						font-weight: 400;
						font-size: 24rpx;
						color: #333333;
						line-height: 34rpx;
					}
				}
			}
		}
		.item-bottom {
			display: flex;
			justify-content: flex-end;
			align-items: center;
			margin-top: 22rpx;
			.all-num {
				font-family: SourceHanSerifCN, SourceHanSerifCN;
				font-weight: 400;
				font-size: 24rpx;
				color: #88888c;
				line-height: 34rpx;
				margin-right: 36rpx;
			}
			.all-money {
				font-family: SourceHanSerifCN, SourceHanSerifCN;
				font-weight: 400;
				font-size: 28rpx;
				color: #383838;
				line-height: 40rpx;
			}
		}
		.item-btns {
			display: flex;
			justify-content: flex-end;
			align-items: center;
			flex-wrap: wrap;
			margin-top: 32rpx;
			.item-btn {
				width: 160rpx;
				height: 60rpx;
				border-radius: 10rpx;
				border: 2rpx solid #e3e7ec;
				display: flex;
				align-items: center;
				justify-content: center;
				font-family: SourceHanSerifCN, SourceHanSerifCN;
				font-weight: 500;
				font-size: 24rpx;
				color: #000000;
				line-height: 34rpx;
				margin-left: 26rpx;
			}
			.bg {
				background-color: $uni-theme-color;
				border: none;
				color: #fff;
			}
		}
	}
}
</style>